![]()
![]()
![]()
Macros ====== This chapter is only valid if you use C as your MUI programming language. Other language interfaces might feature other types of macros or support functions. Please have a look at the supplied interfaces to see how they work. The tree structure that builds up an application also appears in the source code of a MUI program. Since adding child objects is always possible with a special attribute of the parent object, it is common to create the whole tree with one big function call. To help making these calls more clear, the MUI header files contain several macros that simplify the task of object generation. Instead of MUI_NewObject(MUIC_Window, ..., TAG_DONE); MUI_NewObject(MUIC_String, ..., TAG_DONE); MUI_NewObject(MUIC_Slider, ..., TAG_DONE); you can simply use WindowObject, ..., End; StringObject, ..., End; SliderObject, ..., End; Please note that the `xxxObject' macros contain an opening bracket and thus must always be terminated with an `End' macro that contains the matching closing bracket. Besides these "two way" macros, there are also some complete object definitions available which all create specific objects with certain types of attributes. The macro SimpleButton("Cancel") would e.g. generate a complete button object with the correct frame, background and input capabilities. Though lots of these types of macros are available and can of course be used directly in your applications, they are mainly intended as some kind of example. Usually you will need some more sophisticated generation capabilities with a more specific set of macros. Note: If your application needs lots of objects from a specific type (e.g. 200 buttons), you can save some memory by turning macros into functions.